package com.zpark.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Past;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    // 字符串长度校验，长度必须在2~5之间
    @Length(min = 2, max = 5)
    private String name;

    private Integer age;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Past  // 日期校验，日期必须是过去的一个日期
    private Date birth;
}
